<div class="content">
	<div class="title">
	<h2>资料下载</h2>
	</div>
	<div class="downloadblock">
		
		<div class="topsearch">
			<h3>在这里搜索你想要的资源</h3>
			<div class="searchbox">
				<form id="searchform" name="searchform" action="<?php echo $this->baseUrl().'/download/search'?>" method="post">
				<input type="text" value="搜索" id="searchbox" name="searchbox"
					onblur="if(this.value=='') this.value='搜索'; this.style.color='#999'; return true;"
					onfocus="if(this.value=='搜索') this.value='';this.style.color='#333'; return true;"/>
					<button type="submit">
					</button>
				</form>
			</div>
			<h3 id="hehe">请勿用于商业用途!</h3>
		</div>
		<!-- 上传文件的表单一定得加上 enctype="multipart/form-data"-->
		<form id="uploadform" name="uploadform" enctype="multipart/form-data" action="<?php echo $this->baseUrl().'/download/upload'?>"method="post" >
		
		<div class="upload" onclick="$('#selectfile').hide();">
			<input type="file" id="selectfile" name="selectfile"/>
			<button id="uploadfile" name="uploadfile">上传文件</button></div>
        </form>				
		<ul>
			<?php
			//print_r($this->files);
			foreach($this->allfiles as $file)
			{
			    //print_r($file);
			    $href = $this->baseUrl().'/download/download?fileid='.$file['id'];
			    echo "<li><a href=$href>";
			    echo $file['filename'];
			    echo "</a><div class=\"date\">[";
			    echo $file['uploader'];
			    echo "][";
			    $date = new Zend_Date();
			    //echo date_default_timezone_get();
			    //date_default_timezone_set('Asia/Shanghai');无用
			    //echo date_default_timezone_get();
			    echo gmdate('Y-m-d',$file['filedate']+3600 * 8);
			    echo "]</div></li>";
			} 
			
			?>
		</ul>
		
		<!-- <?php print_r(Zend_Registry::getInstance());?> -->
		<div class="page">
		<a href="<?php echo $this->baseUrl().'/download/index?page='.'1';?>">首页</a>
		<a href="<?php echo $this->baseUrl().'/download/index?page='.($this->page-1);?>">上一页</a>

		<?php
			//echo Zend_Registry::get('config');
			if($this->pagecount<=8)
			{
			    $begin = 1;
			    $end = $this->pagecount;//显示8页
			}
			else 
			{
			    if($this->pagecount-$this->page+1<=8)
			    {
			        $begin = $this->pagecount-7;
			        $end = $this->pagecount;
			    }
			    else 
			    {
			        $begin = $this->page;
			        $end = $this->page + 7;
			    }
			    
			}
			for($i = $begin;$i<=$end;$i++)
			{
			    if($i==$this->page)echo $i;//本页页数没有超链接
			 	else 
			 	{
			 	    echo '<a href="';
			 	    echo $this->baseUrl().'/download/index?page='.$i.'"';
			 	    echo '>'.$i.'</a>';
			 	}

			} 
		?>
		<a href="<?php echo $this->baseUrl().'/download/index?page='.($this->page+1);?>"> 下一页 </a>  
		<a href="<?php echo $this->baseUrl().'/download/index?page='.$this->pagecount;?>">尾页</a>
		</div>
	</div>
</div>